package com.dopies.bsdmall.utils;

import java.net.URLEncoder;

import com.dopies.bsdmall.alipay.Keys;

public class AliayUtils {
	
	public static final String TAG = "alipay-sdk";
	public static final int RQF_PAY = 1;
	
	public static String getSignType() {
		return "sign_type=\"RSA\"";
	}
	
	public static String getNewOrderInfo(String order_no, String price) {
		StringBuilder sb = new StringBuilder();
		sb.append("partner=\"");
		sb.append(Keys.DEFAULT_PARTNER);
		sb.append("\"&out_trade_no=\"");
		sb.append(order_no);
		sb.append("\"&subject=\"");
		sb.append(order_no);
		sb.append("\"&body=\"");
		sb.append("安卓客户端购买");
		sb.append("\"&total_fee=\"");
		sb.append(price);
		sb.append("\"&notify_url=\"");
		// 网址需要做URL编码
		sb.append(URLEncoder.encode("http://jyc.dopies.com.cn/includes/modules/payment/alipay.php"));
		sb.append("\"&service=\"mobile.securitypay.pay");
		sb.append("\"&_input_charset=\"UTF-8");
		sb.append("\"&return_url=\"");
		sb.append(URLEncoder.encode("http://jyc.dopies.com.cn/includes/modules/payment/alipay.php"));
		sb.append("\"&payment_type=\"1");
		sb.append("\"&seller_id=\"");
		sb.append(Keys.DEFAULT_SELLER);
		// 如果show_url值为空，可不传
		// sb.append("\"&show_url=\"");
		sb.append("\"&it_b_pay=\"1m");
		sb.append("\"");

		return new String(sb);
	}
}
